<?php
//
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
if($_RQ['op']=='main'){
	$return['params']=array();
	$return['groupset']=$this->plugin_setting('groupset');
	if($_RQ['pid']){
		$return['pid']=$_RQ['pid'];
	}else{
		$return['pid']=0;
	}
	$groupspram=array('uniacid'=>$_SESSION['uniacid'],'isshow'=>'1','mid'=>0,'parentid'=>0);
	$onepluginname=$this->model('goods')->is_onegoods($_SESSION['current_plugin'],$_RQ['pluginname']);
	if($onepluginname){//开启独立商品
			$groupspram['onepluginname']=$onepluginname;
			$return['params']['onepluginname']=$onepluginname;
	}else{
			$groupspram['onepluginname']='';
	}
	$category=pdo_getall('jy_weishop_goods_group',$groupspram,array(),'id','paixu desc');
	foreach($category as &$item){
		$item['childs']=pdo_getall('jy_weishop_goods_group',array('uniacid'=>$_SESSION['uniacid'],'isshow'=>1,'parentid'=>$item['id']),array(),'id','paixu desc');
	}
	$searchkeyword=$this->plugin_setting('search')['keyword'];
	$return['searchkeyword']=explode(';',$searchkeyword);
	$return['category']=$category;
	//推荐
	$groupspram['isrecommand']=1;
	$recommend=pdo_getall('jy_weishop_goods_group',$groupspram);
	$return['recommend']=$return['childs']=$recommend;
	set_html('title','商品分类');
	$return['sharedata']=array(
		'title'=>$return['setting']['share_title']?'分类'.$return['setting']['share_title']:'分类-在线商城',
		'desc'=>$return['setting']['share_desc']?$return['setting']['share_desc']:'在线商城，一个属于自己的个人商城！',
		'link'=>custom_url('jy_weishop/shop.groups//fromuser='.$_SESSION['uid'],true),
		'imgUrl'=>ATTACHMENT_URL.$return['setting']['share_image']
	);
	exi($return);
}
// js 获取数据
	
?>